package com.nbsaas.boot.wms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "仓库货位", model = "仓库货位")
@Entity
@Table(name = "bs_warehouse_location")
@Comment("仓库货位表")
public class WarehouseLocation extends AbstractEntity {

    @Comment("仓库ID")
    @FormField(title = "仓库ID", sortNum = "1", grid = true, required = true)
    private Long warehouseId;

    @Comment("区域ID")
    @FormField(title = "区域ID", sortNum = "2", grid = true, required = true)
    private Long areaId;

    @Comment("货位编码")
    @SearchItem(name = "code", key = "code", label = "货位编码")
    @FormField(title = "货位编码", sortNum = "3", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String code;

    @Comment("货位名称")
    @SearchItem(name = "name", key = "name", label = "货位名称")
    @FormField(title = "货位名称", sortNum = "4", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("货位类型")
    @FormField(title = "货位类型", sortNum = "5", grid = true, type = InputType.select)
    @Column(length = 20)
    private String type; // NORMAL-普通货位, BULK-散货位, SPECIAL-特殊货位

    @Comment("货位状态")
    @FormField(title = "货位状态", sortNum = "6", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // AVAILABLE-可用, OCCUPIED-占用, MAINTENANCE-维护

    @Comment("货位容量")
    @FormField(title = "货位容量", sortNum = "7", grid = true, type = InputType.el_input_number)
    private Integer capacity;

    @Comment("已用容量")
    @FormField(title = "已用容量", sortNum = "8", grid = true, type = InputType.el_input_number)
    private Integer usedCapacity;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "9", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "10", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 